package com.cw.controller;


import com.cw.common.api.ResultObject;
import com.cw.entity.OccupationBed;
import com.cw.service.IOccupationBedService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ly
 * @since 2021-06-10
 */
@Api(tags = {"占床业务"})
@RestController
@RequestMapping("/occupation-bed")

public class OccupationBedController {

    @Autowired
    private IOccupationBedService targetService;

    @ApiOperation("取消占床")
    @PostMapping("/unUsedOccupationBed")
    public ResultObject unUsedOccupationBed(@RequestParam String occupationId, String bedNo) {
        return ResultObject.successReturn(targetService.unUsedOccupationBed(occupationId, bedNo));
    }

    @ApiOperation("取消占床-友商版")
    @PostMapping("/unUsedOccupationBedVersionTwo")
    public ResultObject unUsedOccupationBed(@RequestBody OccupationBed occupationBed) {
        return ResultObject.successReturn(targetService.unUsedOccupationBed(occupationBed));
    }

    @ApiOperation("新增占床")
    @PostMapping("/insertOccupationBed")
    public ResultObject insertOccupationBed(@RequestBody OccupationBed occupationBed) {
        return targetService.insertOccupationBed(occupationBed);
    }
}

